package model;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;

import sun.net.TelnetInputStream;
import sun.net.ftp.FtpClient;
import com.sun.net.*;
import org.apache

public class Ftp {
	 public static void main(String[] args)
     {
     	 String server = "10.56.253.179" ;
         String user = "administrator" ;
         String password = "sybase" ;
         String path = "11" ;
         String filename = "test.txt" ;
         String localpath = "D:/ftp" ;
         try{
         	FtpClient ftpclient = new FtpClient();
         	ftpclient.openServer(server);
         	ftpclient.login(user, password);
         	if(path.length()!=0)
         		ftpclient.cd(path);
         	ftpclient.binary();
         	FTPFile[] fs = ftpclient.list();
         	TelnetInputStream is = ftpclient.get(filename);
         	File file_out = new File(filename);
         	FileOutputStream os = new FileOutputStream(file_out);
         	/*byte[] bytes = new byte[1024];
         	int c;
         	while((c=is.read(bytes))!=-1){
         		os.write(bytes,0,c);
         	}*/
         	
         	is.close();
         	os.close();
         	ftpclient.closeServer();
         }catch(IOException ex){;}
		 
     }
}
